import { WeaTools } from 'ecCom';
import uuid from 'uuid';
import moment from 'moment';

const getCurrentUser = () => new Promise((resolve) => {
    WeaTools.callApi('/api/portal/user/getCurrentUser', 'GET').then((result) => {
      const { data = {} } = result;
      resolve(data);
    });
  });

const getUUID = () => uuid.v4();

const getCurrentDate = () => moment().format('YYYY-MM-DD');

const getCurrentTime = () => moment().format('HH:mm:ss');

const WeaPortalUtils = {
  uuid,
  moment,
  getCurrentUser,
  getUUID,
  getCurrentDate,
  getCurrentTime,
};

export default WeaPortalUtils;
